.class public Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;
.super Ljava/lang/Object;
.source "BrandParser.java"


# static fields
.field private static final ALLSPELL:Ljava/lang/String; = "AllSpell"

.field private static final ENAME:Ljava/lang/String; = "EName"

.field private static final FIRSTLETTER:Ljava/lang/String; = "FirstLetter"

.field private static final ID:Ljava/lang/String; = "Id"

.field private static final IMAGE:Ljava/lang/String; = "Image"

.field private static final MAXVALUE:Ljava/lang/String; = "MaxValue"

.field private static final MINVALUE:Ljava/lang/String; = "MinValue"

.field private static final NAME:Ljava/lang/String; = "Name"

.field private static final REFERPRICERANGE:Ljava/lang/String; = "ReferPriceRange"


# instance fields
.field private TAG:Ljava/lang/String;

.field private url:Ljava/lang/String;


# direct methods
.method public constructor <init>(Ljava/lang/String;)V
    .locals 1
    .parameter "url"

    .prologue
    .line 41
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 38
    const-string v0, ""

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;->url:Ljava/lang/String;

    .line 39
    const-string v0, "BrandParser"

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;->TAG:Ljava/lang/String;

    .line 42
    iput-object p1, p0, Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;->url:Ljava/lang/String;

    .line 43
    return-void
.end method

.method public static build(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    .locals 5
    .parameter "obj"

    .prologue
    const-string v2, "ReferPriceRange"

    .line 132
    new-instance v0, Lcom/bitauto/autoeasy/selectcar/Object/Brand;

    invoke-direct {v0}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;-><init>()V

    .line 134
    .local v0, brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    :try_start_0
    const-string v2, "Name"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->setName(Ljava/lang/String;)V

    .line 135
    const-string v2, "Id"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->setId(I)V

    .line 136
    const-string v2, "FirstLetter"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->setFirstLetter(Ljava/lang/String;)V

    .line 137
    const-string v2, "AllSpell"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->setAllSpell(Ljava/lang/String;)V

    .line 138
    const-string v2, "EName"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->setEName(Ljava/lang/String;)V

    .line 139
    const-string v2, "Image"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->setImage(Ljava/lang/String;)V

    .line 141
    const-string v2, "MinValue"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->setMinValue(Ljava/lang/String;)V

    .line 142
    const-string v2, "MaxValue"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->setMaxValue(Ljava/lang/String;)V

    .line 143
    const-string v2, "ReferPriceRange"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/String;->length()I

    move-result v2

    if-lez v2, :cond_0

    .line 144
    const-string v2, "ReferPriceRange"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->setReferPriceRange(Ljava/lang/String;)V

    :goto_0
    move-object v2, v0

    .line 152
    :goto_1
    return-object v2

    .line 146
    :cond_0
    const-string v2, "\u6682\u65e0"

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->setReferPriceRange(Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 149
    :catch_0
    move-exception v2

    move-object v1, v2

    .line 150
    .local v1, e:Lorg/json/JSONException;
    const-string v2, "BrandParser"

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "error :"

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 151
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V

    .line 152
    const/4 v2, 0x0

    goto :goto_1
.end method


# virtual methods
.method public Paser2Object()Ljava/util/ArrayList;
    .locals 11
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/Brand;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v10, 0x0

    .line 46
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    .line 49
    .local v0, BrandList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/Brand;>;"
    :try_start_0
    iget-object v7, p0, Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;->url:Ljava/lang/String;

    if-eqz v7, :cond_3

    .line 50
    new-instance v5, Lorg/json/JSONArray;

    iget-object v7, p0, Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;->url:Ljava/lang/String;

    invoke-direct {v5, v7}, Lorg/json/JSONArray;-><init>(Ljava/lang/String;)V

    .line 51
    .local v5, jArray:Lorg/json/JSONArray;
    invoke-virtual {v5}, Lorg/json/JSONArray;->length()I

    move-result v6

    .line 52
    .local v6, length:I
    if-eqz v5, :cond_2

    if-lez v6, :cond_2

    .line 53
    const/4 v1, 0x0

    .line 54
    .local v1, brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    const-string v3, ""

    .line 55
    .local v3, flag:Ljava/lang/String;
    const/4 v4, 0x0

    .local v4, i:I
    :goto_0
    invoke-virtual {v5}, Lorg/json/JSONArray;->length()I
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v7

    if-lt v4, v7, :cond_0

    move-object v7, v0

    .line 77
    .end local v1           #brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    .end local v3           #flag:Ljava/lang/String;
    .end local v4           #i:I
    .end local v5           #jArray:Lorg/json/JSONArray;
    .end local v6           #length:I
    :goto_1
    return-object v7

    .line 57
    .restart local v1       #brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    .restart local v3       #flag:Ljava/lang/String;
    .restart local v4       #i:I
    .restart local v5       #jArray:Lorg/json/JSONArray;
    .restart local v6       #length:I
    :cond_0
    :try_start_1
    invoke-virtual {v5, v4}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v7

    invoke-static {v7}, Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;->build(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/Brand;

    move-result-object v1

    .line 58
    if-eqz v1, :cond_1

    .line 59
    invoke-virtual {v1}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->getFirstLetter()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/String;->toUpperCase()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v3, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-nez v7, :cond_1

    .line 60
    invoke-virtual {v1}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->getFirstLetter()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/String;->toUpperCase()Ljava/lang/String;

    move-result-object v3

    .line 61
    new-instance v7, Lcom/bitauto/autoeasy/selectcar/Object/Brand;

    const-string v8, ""

    invoke-direct {v7, v3, v8}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {v0, v7}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 63
    :cond_1
    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_1} :catch_0

    .line 55
    :goto_2
    add-int/lit8 v4, v4, 0x1

    goto :goto_0

    .end local v1           #brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    .end local v3           #flag:Ljava/lang/String;
    .end local v4           #i:I
    :cond_2
    move-object v7, v10

    .line 70
    goto :goto_1

    .end local v5           #jArray:Lorg/json/JSONArray;
    .end local v6           #length:I
    :cond_3
    move-object v7, v10

    .line 73
    goto :goto_1

    .line 75
    :catch_0
    move-exception v7

    move-object v2, v7

    .line 76
    .local v2, e:Lorg/json/JSONException;
    iget-object v7, p0, Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;->TAG:Ljava/lang/String;

    new-instance v8, Ljava/lang/StringBuilder;

    const-string v9, "error :"

    invoke-direct {v8, v9}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    move-object v7, v10

    .line 77
    goto :goto_1

    .line 64
    .end local v2           #e:Lorg/json/JSONException;
    .restart local v1       #brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    .restart local v3       #flag:Ljava/lang/String;
    .restart local v4       #i:I
    .restart local v5       #jArray:Lorg/json/JSONArray;
    .restart local v6       #length:I
    :catch_1
    move-exception v7

    goto :goto_2
.end method

.method public Paser2Object2()Ljava/util/ArrayList;
    .locals 10
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/Brand;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v9, 0x0

    .line 90
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    .line 93
    .local v0, BrandList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/Brand;>;"
    :try_start_0
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;->url:Ljava/lang/String;

    if-eqz v6, :cond_3

    .line 94
    new-instance v4, Lorg/json/JSONArray;

    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;->url:Ljava/lang/String;

    invoke-direct {v4, v6}, Lorg/json/JSONArray;-><init>(Ljava/lang/String;)V

    .line 95
    .local v4, jArray:Lorg/json/JSONArray;
    invoke-virtual {v4}, Lorg/json/JSONArray;->length()I

    move-result v5

    .line 96
    .local v5, length:I
    if-eqz v4, :cond_2

    if-lez v5, :cond_2

    .line 97
    const/4 v1, 0x0

    .line 99
    .local v1, brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    const/4 v3, 0x0

    .local v3, i:I
    :goto_0
    invoke-virtual {v4}, Lorg/json/JSONArray;->length()I
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v6

    if-lt v3, v6, :cond_0

    move-object v6, v0

    .line 117
    .end local v1           #brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    .end local v3           #i:I
    .end local v4           #jArray:Lorg/json/JSONArray;
    .end local v5           #length:I
    :goto_1
    return-object v6

    .line 101
    .restart local v1       #brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    .restart local v3       #i:I
    .restart local v4       #jArray:Lorg/json/JSONArray;
    .restart local v5       #length:I
    :cond_0
    :try_start_1
    invoke-virtual {v4, v3}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v6

    invoke-static {v6}, Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;->build(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/Brand;

    move-result-object v1

    .line 102
    if-eqz v1, :cond_1

    .line 103
    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_1} :catch_0

    .line 99
    :cond_1
    :goto_2
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .end local v1           #brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    .end local v3           #i:I
    :cond_2
    move-object v6, v9

    .line 110
    goto :goto_1

    .end local v4           #jArray:Lorg/json/JSONArray;
    .end local v5           #length:I
    :cond_3
    move-object v6, v9

    .line 113
    goto :goto_1

    .line 115
    :catch_0
    move-exception v6

    move-object v2, v6

    .line 116
    .local v2, e:Lorg/json/JSONException;
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/BrandParser;->TAG:Ljava/lang/String;

    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "error :"

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    move-object v6, v9

    .line 117
    goto :goto_1

    .line 104
    .end local v2           #e:Lorg/json/JSONException;
    .restart local v1       #brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    .restart local v3       #i:I
    .restart local v4       #jArray:Lorg/json/JSONArray;
    .restart local v5       #length:I
    :catch_1
    move-exception v6

    goto :goto_2
.end method
